/******************************************************************************
*	cmSem.h	Header file of CM Sem Module
*
*	coypright (C) 2009 Ding Lixing
*
******************************************************************************/


#ifndef __CMSEM_INC__
#define __CMSEM_INC__

#ifdef __cplusplus
extern "C" {
#endif

struct cmSemData_typ {
    int          v;
    unsigned int vMax;
};
typedef struct cmSemData_typ cmSEMDATA;

struct cmSem_typ {
    cmOBJ       obj;
    cmSEMDATA   data;
};
typedef struct cmSem_typ cmSEM;

int cmSemInit(cmSEM *sem, unsigned int opt, int v, int vMax);
int cmSemValueQuery(cmSEM *sem);
int cmSemGive(cmSEM *sem);
int cmSemTake(cmSEM *sem, unsigned int tout);

#ifdef __cplusplus
}
#endif

#endif /* __CMSEM_INC__ */

